project(
  QsLog
  LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 17)
find_package(Qt5 COMPONENTS Core REQUIRED)

# 指定预定义预处理器符号
add_definitions(-DQS_LOG_LINE_NUMBERS)      # automatically writes the file and line for each log message
#add_definitions(-DQS_LOG_DISABLE)           # logging code is replaced with a no-op
add_definitions(-DQS_LOG_SEPARATE_THREAD)   # messages are queued and written from a separate thread

set(_srcs
    QsLog.cpp
    QsLogDest.cpp
    QsLogDestConsole.cpp
    QsLogDestFile.cpp
    QsLogDestFunctor.cpp
)

set(_headers
    QsLog.h
    QsLogDest.h
    QsLogDestConsole.h
    QsLogDestFile.h
    QsLogDestFunctor.h
    QsLogDisableForThisFile.h
    QsLogLevel.h
)

add_library(QsLog SHARED ${_srcs} ${_headers})
target_link_libraries(QsLog PUBLIC
    Qt5::Core ${CMAKE_THREAD_LIBS_INIT}
)
target_include_directories(QsLog PUBLIC .)
